import React from 'react'
import store from '../../store/store'

import {
  getMovieAction
} from '../../store/actions/movieAction'

export default function Movie() {

  const {count}  = store.getState().count //拿到store中的数据
  const {movieList}  = store.getState().movie //拿到store中的数据


  const getMovieHandle = () => {
    store.dispatch(getMovieAction())
  }


  return (
    <div>
        <h1>我是Movie组件我用Count组件的count{count}</h1>
        <p>我的电影条数是{movieList.length}</p>
        <button onClick = {getMovieHandle}>获取电影列表</button>
        <ul>
            {
              movieList.map(item => {
                return <li key={item.tvId}>{item.albumName}</li>
              })
            }
        </ul>
    </div>
  )
}
